local StarterGui = game:GetService("StarterGui");
local ClientOHOH = _G.ClientOHOH;
local OHOHEnum = ClientOHOH.load.OHOHEnum();
local M = ClientOHOH.class.new(script, ClientOHOH.files.ClientBase());



function M.new()
	return M();
end;
function M.ctor(self)
	_G.CommonOHOH.load.GameTool().CreateConnectEvent(self)

	_G.client = self;
	local UserInputService = game:GetService("UserInputService")
	self.IsMobile=false
	if UserInputService.TouchEnabled then
		self.IsMobile=true
	end
	
	--game.Workspace.Gravity = 120;

	--warn("----------是移动端吗:",self.IsMobile)
	M.super.ctor(self);
end;
local LoadingGui = ClientOHOH.load.LoadingGui();
local UIManager = ClientOHOH.load.UIManager();
local ContentProvider = game:GetService("ContentProvider");

function M.OnStart(self)
	-- print("-------OnStart-------0-")

	self.loading_gui = LoadingGui.new();
	self.loading_gui:SetStepFunc(1, function()
		UIManager:InstallUIList();	
		-- print("-------OnStart-------1-")
	end);
	self.loading_gui:SetStepFunc(2, function()
		-- print("-------OnStart-------2-")

	end);
	self.loading_gui:SetStepFunc(3, function()
		ContentProvider:PreloadAsync({});
		-- print("-------OnStart-------3-")

	end);
	self.loading_gui:SetStepFunc(4, function()
		-- print("-------OnStart-------4-")

	end);
	self.loading_gui:SetStepFunc(5, function()
		-- print("-------OnStart-------4.5-")
		_G.GlobalTipGui=UIManager.ui_list.GlobalTipGui
		self:CreateLoaclPlayer();
		-- print("-------OnStart-------5-")

	end);
	
	self.Starting=true
	self.loading_gui:StartLoading();

end;




function M.OnPlayerIn(self)

	if self.Starting then
		self.Starting=nil
		self:InitComponent()
		self.local_player:CreateCharacter()

		self:AddProcess(function()
			self:Wait(0.8)
			self.loading_gui:dtor()
		end)
	end
end

-- 已经有player对象，character对象还未窗口
function M.InitComponent(self)
	_G.POOL=self:AddComponent(_G.CommonOHOH.load.PoolComponent()); --初始化对象池
	self:AddComponent(_G.CommonOHOH.load.PoolComponent())--加载
	self:AddComponent(_G.CommonOHOH.load.GameRule())--比赛规则控制器
end


function M.dtor(self)
	M.super.dtor(self);
end;
return M;